{% extends "simgenex/base_simgenex.html" %}
{% load ts_extras %}
{%block center%}
<div>
    <h2>{{request.session.sgx_program.name}}</h2>
    <p>
        {{request.session.sgx_program.desc}}
    </p>
    <form action="runSimulation" method="post" class="edit">
        {% csrf_token %}
        <fieldset class="border" id="init">
            <legend></legend>
            <div class="input-field">
                <label>Transsys program</label>
                <span class="helptext">Select the transsys program that you want to apply the simulation</span>
                <select name="tp" >
                    {% for target_tp in request.session.sgx_program.target_tp %}
                    <option value="{{target_tp.name}}"
                            {% if target_tp.name == tp_name %}
                                selected="selected"
                            {% endif %}
                            >{{target_tp.name}}</option>
                    {% endfor %}
                </select>
            </div>
            <div class="infut-field">
                <button type="submit" name="submit">Run</button>
            </div>
        </fieldset>
        {% if expression_set %}
            <div>
                <h2>Simulated expression level by applying simgenex program {{request.session.sgx_program.name}} to transsys program {{tp_name}}:</h2>
                <table id="fc_table">
                    <colgroup>
                        <col class="oce-first" />
                    </colgroup>
                    <tr>
                        <th scope="col"></th>
                        {% for col in expression_set.get_column_name_list %}
                        <th scope="col" >{{col}}</th>
                        {% endfor %}
                    </tr>
                    {% for row in row_list %}
                    <tr>
                        <td>{{row.name}}</td>
                        {% for fc in row.fc_list %}
                        <td>{{fc}}</td>
                        {% endfor %}
                    </tr>
                    {% endfor %}
                </table>
            </div>
            <a class="link-button" title="Download simulated data" href="{% url tsworkbench.views.sgx.downloadSimulatedData request.session.sgx_program.name|escapeUrl tp_name %}">Download simulated data</a>
        {% endif %}
    </form>
</div>
{% endblock %}